/*
	file tguil.h
*/
/*---------------------------------------------------------------------------*/
#ifndef __TGUIL_H
#define __TGUIL_H
/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
 extern "C" {
#endif 

/* Includes ------------------------------------------------------------------*/
#include "stdint.h"
/*---------------------------------------------------------------------------*/
#ifndef NULL
#define NULL 0
#endif
typedef struct
{
    int             sx;
    int             sy;
    int             ex;
    int             ey;
}UI_AREA_T;

struct ui_object;

/* 每个界面仅有一个控制器 */
typedef struct
{
    struct ui_object        *   origin;//原点
    struct ui_object        *   point;//焦点

    unsigned  int               eventid;//extenal event id(keyboared only)
}UI_CTRL_T;


typedef void (*ui_event_cb_t)(struct ui_object * obj, unsigned char event);
typedef unsigned char (*ui_signal_cb_t)(struct ui_object * obj, unsigned char sign, void * param);//param 一般传入ui_ctrl_t
typedef struct ui_object
{
    struct ui_object        *   par;
    struct ui_object        *   item;
    struct ui_object        *   pre;
    struct ui_object        *   next;

    UI_AREA_T                   area;//relative position

    void                    *   pdata;//object data,used by signal_cb

    ui_event_cb_t               event_cb;//用户设置用事件
    ui_signal_cb_t              signal_cb;//
    
    unsigned char               status;//0无动作 1 需要重绘
    unsigned char               hiden;//是否隐藏
    unsigned char               select;//是否可选

    void                    *   pudata;//user data,used by event_cb
}ui_object_t;


/*---------------------------------------------------------------------------*/
#ifdef __cplusplus
}
#endif

#endif /* __GUIL_H */
